// app.js
import dayjs from "./utils/dayjs.min";
import {
  get_show,
  get_kebiao,
  sendMessage,
  dianzan,
  getEmojis
} from './api/shool/get_score.js'
App({

  //获取当前版本号
  getVersion() {
    const accountInfo = wx.getAccountInfoSync();
    let version = accountInfo.miniProgram.version
    console.log('envVersion', __wxConfig.envVersion);
    console.log('当前版本号', version);
    return '1.0.24'
    return version;

  },


  // 引入`towxml3.0`解析方法
  // towxml:require('./towxml/index'),

  //渐入，渐出实现 
  show: function (that, param, opacity) {
    var animation = wx.createAnimation({
      //持续时间800ms
      duration: 600,
      timingFunction: 'ease',
    });
    //var animation = this.animation
    animation.opacity(opacity).step()
    //将param转换为key
    var json = '{"' + param + '":""}'
    json = JSON.parse(json);
    json[param] = animation.export()
    //设置动画
    that.setData(json)
  },

  //滑动渐入渐出
  slideupshow: function (that, param, px, opacity) {
    var animation = wx.createAnimation({
      duration: 600,
      timingFunction: 'ease',
    });
    animation.translateY(px).opacity(opacity).step()
    //将param转换为key
    var json = '{"' + param + '":""}'
    json = JSON.parse(json);
    json[param] = animation.export()
    //设置动画
    console.log(json)
    that.setData(json)
  },

  //向右滑动渐入渐出
  sliderightshow: function (that, param, px, opacity) {
    var animation = wx.createAnimation({
      duration: 600,
      timingFunction: 'ease',
    });
    animation.translateX(px).opacity(opacity).step()
    //将param转换为key
    var json = '{"' + param + '":""}'
    json = JSON.parse(json);
    json[param] = animation.export()
    //设置动画

    that.setData(json)
  },

  //推送用户消息
  send_message: function (data) {
    console.log(data)
    sendMessage(data).then(res => {
      console.log(res)
    })
  },

  //添加留言
  add_message: function (data) {

  },

  //获取手机型号
  get_model: function () {
    var model = '';
    wx.getSystemInfo({
      success: function (res) {
        model = res;
      }
    });
    console.log(model);
    return model;
  },

  //点赞
  dianzan: function (data) {
    dianzan(data).then(res => {
      console.log(res)
    })
  },






  onLaunch() {

    this.globalData.phone_info = this.get_model()




    // 展示本地存储能力
    this.globalData.userInfo = wx.getStorageSync('userinfo')
  },

  globalData: {
    userInfo: null,
    type_1: null,
    phone_info: null,
    id: null,
    time: null,


  }
})